import React, { Component } from 'react';
import { Form, Select, Input, Button, Modal } from 'antd';
const FormItem = Form.Item;
const Option = Select.Option;
const { TextArea } = Input;

class PopForm2 extends Component {
  render() {
    const { visible, onCancel, onCreate, form, infor } = this.props;
    const { getFieldDecorator } = form;
    const typeInfor = this.props.infor ? this.props.infor : {};
    return (
      <Modal
        visible={visible}
        title="编辑"
        okText="确定"
        cancelText="取消"
        onCancel={onCancel}
        onOk={onCreate}
      >
        <Form>
          <FormItem
            label="服务编码"
            labelCol={{ span: 5 }}
            wrapperCol={{ span: 16 }}
          >
            {getFieldDecorator('code', {
              rules: [{ required: true, message: '请输入服务编码!', }],
              initialValue: typeInfor.code
            })(
              <Input placeholder="请输入服务编码" />
            )}
          </FormItem>
          <FormItem
            label="服务密钥"
            labelCol={{ span: 5 }}
            wrapperCol={{ span: 16 }}
          >
            {getFieldDecorator('secret', {
              rules: [{ required: true, message: '请输入服务密钥!', }],
              initialValue: typeInfor.secret
            })(
              <Input placeholder="请输入服务密钥" />
            )}
          </FormItem>
          <FormItem
            label="服务名"
            labelCol={{ span: 5 }}
            wrapperCol={{ span: 16 }}
          >
            {getFieldDecorator('name', {
              rules: [{ required: true, message: '请输入服务名!', }],
              initialValue: typeInfor.name
            })(
              <Input placeholder="请输入服务名" />
            )}
          </FormItem>
          <FormItem
            label="描述"
            labelCol={{ span: 5 }}
            wrapperCol={{ span: 16 }}
          >
            {getFieldDecorator('description', {
              rules: [{ required: true, message: '请输入描述!', }],
              initialValue: typeInfor.description
            })(
              <Input placeholder="请输入描述" />
            )}
          </FormItem>
        </Form>
      </Modal>
    );
  }

}
const EditForm = Form.create()(PopForm2);
export default EditForm;